Skip to content

Conversation

@robinNcode
Copy link
Owner

  • Fix CHAR column type generation syntax
  • Fix VARCHAR column type generation syntax
  • Fix DECIMAL column type generation with precision and scale

Previously, the mapToLaravelType() method was returning malformed
strings like 'char, 10' which resulted in invalid migration syntax:
$table->char, 10('column_name');

This commit refactors the method to return an array structure
containing the method name and parameters separately, allowing
proper syntax generation:
$table->char('column_name', 10);
$table->string('column_name', 255);
$table->decimal('column_name', 8, 2);

Changes:

  • Refactored mapToLaravelType() to return ['method' => '...', 'length' => '...']
  • Updated getColumnDefinition() to handle new array structure
  • Added proper parameter formatting for decimal types (precision, scale)

Tested with MySQL CHAR(10), VARCHAR(255), DECIMAL(8,2) columns"

Signed-off-by: robinNcode <msmrobin518@gmail.com>
@robinNcode robinNcode merged commit ffcbf30 into master Nov 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants